It is common in software systems, especially software systems that control the operation of external hardware (referred to here as “control systems” or “control applications”, to perform certain processing (referred to here as “services”) at periodic intervals (also referred to here as “periodic events”) that occur after such periodic intervals elapse. Typically, a different set of services is executed for each different type of periodic event. The periodic interval of time associated with each periodic event is typically defined as a number of clock ticks. A clock tick is a signal or other indication that a predetermined base interval of time (for example, 100 milliseconds) has elapsed since the last clock tick elapsed.
For example, in one approach, a clock or timer sends an interrupt after each clock tick. An interrupt handler executes a periodic event scheduler. The periodic event scheduler determines which services should be executed in response to that clock tick. For example, in one example, a first set of services is executed after every tick (where a tick is generated every 100 milliseconds), while a second set of services is executed every second (that is, every 10 clock ticks). The periodic event scheduler maintains a counter for the second set of services to count the number of ticks that have occurred since the second set of services was last executed. This is done to determine when one second (the period for this type of periodic event) has elapsed since the second set of services was last executed.
In such an example, when an interrupt is generated to signal that a tick has elapsed, an interrupt handler executes the periodic event scheduler. The periodic event scheduler determines that the first set of services is to be executed (because the first set is executed for every tick). The periodic event scheduler initiates execution of all the services in the first set at the beginning of the current 100 millisecond period. If the counter indicates that a second has elapsed since the second set of services was last executed, the periodic event scheduler initiates execution of all the services in the second set, also at the beginning of the current 100 millisecond period.
In this example, the workload involved in executing the services will be bursty, with a burst of processing activity occurring at the beginning of each one-second interval when the execution of both the first and second sets of services is initiated. When the system is loaded while executing such a burst of periodic events is executing, system performance for other processes may be degraded. Moreover, if multiple services in a single burst exercise the same item of hardware, a power consumption surge may result.